package com.sx.gongzhong.activity;

import android.os.Bundle;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.luck.picture.lib.photoview.PhotoView;
import com.sx.gongzhong.BaseActivity;
import com.sx.gongzhong.R;

import butterknife.ButterKnife;
import butterknife.Unbinder;

public class ImagePlayActivity extends BaseActivity {

    private PhotoView photoView;
    private String mPath;
    private Unbinder bund;


    @Override
    public void setUI(Bundle savedInstanceState) {
        setContentView(R.layout.activity_image_play);
        setTitleName("查看图片");
        bund=ButterKnife.bind(this);
        photoView= (PhotoView) findViewById(R.id.tvPhoto);
        mPath = getIntent().getStringExtra("path");
        RequestOptions options = new RequestOptions()
                .placeholder(R.mipmap.img_fail)
                .error(R.mipmap.img_fail)
                .diskCacheStrategy(DiskCacheStrategy.RESOURCE);
        Glide.with(this)
                .load(mPath)
                .apply(options)
                .into(photoView);

    }

    @Override
    protected void onDestroy() {
        bund.unbind();
        super.onDestroy();
    }
}
